import {PluginCommand} from "../PluginCommand";

class PointCloudReconstructionCommand extends PluginCommand{
  constructor() {
    super();
  }

  getElementsByFeatureNames(featureNames, cb){
    if (this.query) {
      this.query.getElementsByFeatureNames(featureNames).then(res => {
        cb(res);
      })
    }
  }

  getFeaturesByNames(featureNames, cb){
    if (this.query) {
      this.query.getFeaturesByNames(featureNames).then(res => {
        cb(res);
      })
    }
  }

  //点云网格化计算点间距离
  getNeighborDistance(params, cb) {
    if (this.toolQuery) {
      this.toolQuery.executeComputePclDistanceCmd({id: params}).then(res => {
        cb(res?.data?.deviationDistance);
      });
    }
  }

  //点云网格化预览
  previewPointCloudReconstruction(cmd, cb){
    if (this.toolQuery) {
      this.toolQuery.executePreviewPointCloudReconstructionCmd(cmd).then(res => {
        cb(res?.data?.triangleNum);
      });
    }
  }
  //点云网格化创建
  createPointCloudReconstruction(cmd, cb){
    if (this.toolQuery) {
      this.toolQuery.executeCreatePointCloudReconstructionCmd(cmd).then(res => {
        cb(res?.data?.triangleNum);
      });
    }
  }
}

const pointCloudReconstructionCommand = new PointCloudReconstructionCommand();
export {pointCloudReconstructionCommand};
